{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}
{% set _preview      = block('preview') %}
{% set _form         = block('form') %}
{% set _show         = block('show') %}
{% set _list_table   = block('list_table') %}
{% set _list_filters = block('list_filters') %}
{% set _side_menu    = block('side_menu') %}
{% set _content      = block('content') %}
{% set _title        = block('title') %}
{% set _breadcrumb   = block('breadcrumb') %}
<!DOCTYPE html>
<html class="no-js">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        {% block stylesheets %}
            <!-- jQuery code -->
            <link rel="stylesheet" href="{{ asset('bundles/sonatajquery/themes/flick/jquery-ui-1.8.16.custom.css') }}" type="text/css" media="all" />

            <link rel="stylesheet" href="{{ asset('bundles/sonataadmin/bootstrap/bootstrap.min.css') }}" type="text/css" media="all" >

            <!-- base application asset -->
            <link rel="stylesheet" href="{{ asset('bundles/sonataadmin/css/layout.css') }}" type="text/css" media="all">
            <link rel="stylesheet" href="{{ asset('bundles/sonataadmin/css/colors.css') }}" type="text/css" media="all">
            <link rel="stylesheet" href="{{ asset('bundles/sonataadmin/css/colors.css') }}" type="text/css" media="all">
            
            {% stylesheets 'bundles/amistate/admincss/*' filter='cssrewrite,?yui_css'  %}
            <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
            {% endstylesheets %}
        
        {% endblock %}

        {% block javascripts %}
            <script src="{{ asset('bundles/sonatajquery/jquery-1.7.1.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonatajquery/jquery-ui-1.8.17.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonatajquery/jquery-ui-i18n.js') }}" type="text/javascript"></script>

            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-tabs.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-alerts.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-modal.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-twipsy.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-popover.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-scrollspy.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/bootstrap/js/bootstrap-dropdown.js') }}" type="text/javascript"></script>

            <script src="{{ asset('bundles/sonataadmin/qtip/jquery.qtip-1.0.0-rc3.min.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/jquery/jquery.form.js') }}" type="text/javascript"></script>
            <script src="{{ asset('bundles/sonataadmin/base.js') }}" type="text/javascript"></script>
        {% endblock %}

        <title>
            {% trans from 'SonataAdminBundle' %}Admin{% endtrans %}

            {% if _title is not empty %}
                {{ _title|raw }}
            {% else %}
                {% if action is defined %}
                    -
                    {% for label, uri in admin.breadcrumbs(action) %}
                        {% if not loop.first  %}
                            &gt;
                        {% endif %}
                        {{ label }}
                    {% endfor %}
                {% endif %}
            {% endif%}
        </title>
    </head>
    <body class="sonata-bc {% if _side_menu is empty %}sonata-ba-no-side-menu{% endif %}">
        {# initialize block value #}

        <div class="topbar" data-dropdown="dropdown" >
            <div class="topbar">
                <div class="topbar-inner">
                    <div class="container-fluid">
                        {% if admin_pool is defined %}
                            {% block logo %}
                                <a href="{{ url('sonata_admin_dashboard') }}" class="brand">
                                    <img src="{{ asset(admin_pool.titlelogo) }}"  alt="{{ admin_pool.title }}" />
                                    {{ admin_pool.title }}
                                </a>
                            {% endblock %}
                            {% if app.user %}
                                <ul class="nav">
                                    {% for group in admin_pool.dashboardgroups %}
                                        <li class="dropdown">
                                            <a href="#" class="dropdown-toggle">{{ group.label|trans({}, group.label_catalogue) }}</a>
                                            <ul class="dropdown-menu">
                                                {% for admin in group.items %}
                                                    {% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
                                                        <li><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
                                                    {% endif %}
                                                {% endfor %}
                                            </ul>
                                        </li>
                                    {% endfor %}
                                </ul>
                            {% endif %}

                            <p class="pull-right">{% include admin_pool.getTemplate('user_block') %}</p>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
            
            {% render "AmistateBundle:AdminGlobal:header" %}
            
        <div class="container-fluid">
            {% if _breadcrumb is not empty or action is defined %}
                <ul class="breadcrumb">
                    {% if _breadcrumb is empty %}
                        {% if action is defined %}
                            {% for label, uri in admin.breadcrumbs(action) %}
                                {% if not loop.last  %}
                                    <li><a href="{{ uri }}">{{ label }}</a><span class="divider">/</span></li>
                                {% else %}
                                    <li class="active">{{ label }}</li>
                                {% endif %}
                            {% endfor %}
                        {% endif %}
                    {% else %}
                        {{ _breadcrumb|raw }}
                    {% endif %}
                </ul>
            {% endif %}

            {% block notice %}
                {% for notice_level in ['success','error','info', 'warning'] %}
                    {% set session_var = 'sonata_flash_' ~ notice_level %}
                    {% if app.session.hasFlash(session_var) %}
                        <div class="alert-message {{ notice_level }}">
                            {{ app.session.flash(session_var) | trans([],'SonataAdminBundle') }}
                            {#<a class="close" href="#">×</a>#}
                        </div>
                    {% endif %}
                {% endfor %}
            {% endblock %}

            <div style="float: right">
                {%block actions %}{% endblock %}
            </div>

            {% if _title is not empty or action is defined %}
                <div class="page-header">
                    <h1>
                        {% if _title is not empty %}
                            {{ _title|raw }}
                        {% elseif action is defined %}
                            {% for label, uri in admin.breadcrumbs(action) %}
                                {% if loop.last  %}
                                    {{ label }}
                                {% endif %}
                            {% endfor %}
                        {% endif%}
                    </h1>
                </div>
            {% endif%}

            {% if _side_menu is not empty %}
                <div class="sidebar">
                    <div class="well sonata-ba-side-menu">{{ _side_menu|raw }}</div>
                </div>
            {% endif %}

            <div class="content">

                {% if _preview is not empty %}
                    <div class="sonata-ba-preview">{{ _preview|raw }}</div>
                {% endif %}


                {% if _content is not empty %}
                    <div class="sonata-ba-content">{{ _content|raw }}</div>
                {% endif %}

                {% if _show is not empty %}
                    <div class="sonata-ba-show">{{ _show|raw }}</div>
                {% endif %}

                {% if _form is not empty %}
                    <div class="sonata-ba-form">{{ _form|raw }}</div>
                {% endif %}

                {% if _list_table is not empty or _list_filters is not empty %}
                    <div class="sonata-ba-filter">
                        {{ _list_filters|raw }}
                    </div>
                    <div class="sonata-ba-list">
                        {{ _list_table|raw }}
                    </div>
                {% endif %}

                {% block footer %}
                    <div class="pull-right clearfix">
                        <span class="label"><a href="http://sonata-project.org" rel="noreferrer" style="text-decoration: none; color: black">Sonata Project</a></span>
                    </div>
                {% endblock %}
            </div>
        </div>
    </body>
</html>

